<?php
/**
 * 利用mysqli 实现多语句查询
 * User: Administrator
 * Time: 2015/12/10 18:57
 */

$con = new mysqli('localhost', 'root', '', 'onethink');

if(mysqli_connect_errno()){
	echo '数据库连接出错，错误信息：'.mysqli_connect_error();
}

$sql_action = "SELECT * FROM onethink_action LIMIT 1";
$sql_menu = "SELECT * FROM onethink_menu LIMIT 1";


$res = $con->multi_query($sql_action.';'.$sql_menu);

if ($res) {
	do {
		if ($result = $con->store_result()) {
			while ($row = $result->fetch_row()) {
				var_dump($row);
			}
			$result->free();
		}
	} while ( $con->more_results() &&  $con->next_result());
}
